import React, { Component } from 'react';
import DataDisplay from './components/DataDisplay';
import ProgressTable from './components/ProgressTable'
import { hashHistory } from 'react-router';
import { Loading } from '../commons'
import { getUser } from '../../auth'
import { TaskService } from '../../services'

export default class PublishList extends Component {
  static displayName = 'PublishList';

    static defaultProps = {
    status : [
      {
        count: 0,
        title: '推送中',
      },
      {
        count: '0',
        title: '本月推送数量',
      },
      {
        count: '0',
        title: '总推送数量',
      },
    ]
  };

  constructor(props) {
    super(props);
    this.state = {
      loading : true,
      channel : [],
    };
  }

  componentDidMount = async() =>{
    let user = getUser()
    let status = await TaskService.status()
    this.setState({ loading : false, status : status })
  }

  render() {
    return (
      <div className="publish-page">
        <Loading loading={this.state.loading}/>
        <DataDisplay status={this.state.status}/>
        <ProgressTable />
      </div>
    );
  }
}

const styles = { }